package com.Object.EqualsExercise;

/**
 * @Author 小闽
 * @Date 2024/8/14 11:36
 * @PackageName: com.Object.EqualsExercise
 * @ClassName: EqualsExercise02
 * @Description: 练习
 * @Version 1.0
 */
public class EqualsExercise02 {
    public static void main(String[] args) {
        Person01 p1 = new Person01();
        p1.name = "苏宁易购";
        Person01 p2 = new Person01();
        p2.name = "苏宁易购";
        System.out.println(p1 == p2);  // false
        System.out.println(p1.name.equals(p2.name)); // true
        System.out.println(p1.equals(p2)); // false
        /**
         * 子类被重写
         */
        String s1 = new String("苏宁易购");
        String s2 = new String("苏宁易购");
        System.out.println(s1.equals(s2)); // true
        System.out.println(s1 == s2); // false


    }
}
